#include <iostream>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>

using namespace std;

class Animal
{

    friend ostream &operator<<(ostream &o, Animal &a);

public:
    Animal(string name, int age)
    {
        m_name = name;
        m_age = age;
        cout << " 有参构造函数 m_name = " << m_name << " m_age =  " << m_age << endl;
    }
    Animal()
    {
        cout << " 无参构造函数 " << endl;
    }
    ~Animal(){
        cout<<"end..."<<m_name <<endl;
        // if(m_name != NULL){
        //     delete m_name;
        //     m_name = NULL;
        // }
    }

private:
    string m_name;
    int m_age;
};
ostream &operator<<(ostream &o, Animal &a)
{
    cout << " m_name = " << a.m_name << " m_age =  " << a.m_age << endl;
    return o;
};

int main(int argc, char **argv)
{

    Animal ani, ani2("小狗", 4);

    cout<<ani2;

    return 0;
}